using System;
using System.Collections;
using System.Collections.Generic;
using Cinemachine;
using Unity.VisualScripting;
using UnityEngine;

namespace Enemy{
    public enum StateType
    {
        Idle,
        Attack1,
        Wind,
        Flog,
        Activate
    }


    public class FSM : OptionalArea
    {
        public new string tag;
        public Parameter parameter;
        protected IState currentState;
        protected Dictionary<StateType, IState> states = new Dictionary<StateType, IState>();
        public PlayerController pc;

        public void TransitionState(StateType type)
        {
            if (currentState != null) currentState.OnExit();
            currentState = states[type];
            currentState.OnEnter();
        }

        public virtual void FlipTo(Transform target)
        {
            if (target)
            {
                if (transform.position.x > target.position.x)
                {
                    transform.localScale = new Vector3(-7, 7, 1);
                }
                else if (transform.position.x < target.position.x)
                {
                    transform.localScale = new Vector3(7, 7, 1);
                }
            }
        }


    }
}
